feat(digest): implement weekly financial digest (#121)#642
Open
DeekRoumy wants to merge 1 commit intorohitdash08:mainfrom
Open
feat(digest): implement weekly financial digest (#121)#642DeekRoumy wants to merge 1 commit intorohitdash08:mainfrom
DeekRoumy wants to merge 1 commit intorohitdash08:mainfrom
Conversation
Add a weekly financial digest feature that generates summaries
highlighting trends and insights for any given week.
Backend changes:
- New service: packages/backend/app/services/digest.py
- _heuristic_digest: rules-based weekly summary (no API key required)
- _gemini_digest: AI-enhanced insights using Gemini API
- weekly_digest(): public API with graceful fallback
- New route: GET /insights/weekly-digest
- Optional ?week=YYYY-MM-DD query param (defaults to current week)
- X-Gemini-Api-Key / X-Insight-Persona headers supported
- Returns: week_start, week_end, total_expenses, total_income,
net_flow, wow_change_pct, top_categories, daily_breakdown, insights
- OpenAPI: fully documented new endpoint with schema and examples
- Tests: packages/backend/tests/test_digest.py (6 test cases)
Frontend changes:
- New page: app/src/pages/WeeklyDigest.tsx
- Summary cards: expenses, income, net flow, previous week
- Top spending categories table
- Day-by-day breakdown list
- Insights panel (AI-powered or heuristic)
- Week picker + optional Gemini API key input
- New API type: WeeklyDigest + getWeeklyDigest() in api/insights.ts
- New route: /weekly-digest (protected)
- Navbar: 'Weekly Digest' link added
Acceptance criteria:
✅ Production-ready implementation with error handling + fallbacks
✅ Tests included (6 backend test cases)
✅ Documentation updated (OpenAPI spec + inline docstrings)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #121
Implements a complete weekly financial digest feature that generates summaries highlighting trends and actionable insights for any given week.
What's included
Backend
packages/backend/app/services/digest.py_heuristic_digest(): rule-based weekly summary (no API key needed)_gemini_digest(): AI-enhanced insights via Gemini (optional)weekly_digest(): public API with graceful fallback if Gemini failsGET /insights/weekly-digest?week=YYYY-MM-DD(any day in the week; defaults to current week)X-Gemini-Api-Key/X-Insight-Personaheaders respectedweek_start,week_end,total_expenses,total_income,net_flow,week_over_week_change_pct,previous_week_expenses,top_categories,daily_breakdown,insights,methodFrontend
app/src/pages/WeeklyDigest.tsxWeeklyDigest+getWeeklyDigest()inapi/insights.ts/weekly-digest(protected)Acceptance Criteria
/claim #121